<?php
include("config.php");

$ip=$_SERVER['REMOTE_ADDR']; 


$id=$_POST['id'];
$id = mysql_escape_String($id);

$ip_sql=mysql_query("select ip_add from Voting_IP where mes_id_fk='$id' and ip_add='$ip'");
$count=mysql_num_rows($ip_sql);

if($count!=0)
{
$sql = "update Messages set totalvotes=totalvotes-1  where mes_id='$id'";
mysql_query( $sql);

$sql_in = "DELETE FROM Voting_IP WHERE mes_id_fk='$id'";
mysql_query( $sql_in);



}
else
{
}

?>